<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>博客</title>
    <link rel="stylesheet" type="text/css" th:href="@{/stage/css/semantic.min.css}">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
    <script src="https://cdn.jsdelivr.net/npm/jquery.scrollto@2.1.2/jquery.scrollTo.min.js"></script>
    <link rel="stylesheet" th:href="@{/stage/css/index.css}">
    <link rel="stylesheet" th:href="@{/stage/css/iconfont.css}"/>
    <script type="text/javascript" th:src="@{/stage/js/jquery-1.10.2.js}"></script>
    <script type="text/javascript" th:src="@{/stage/js/semantic.min.js}"></script>
    <link rel="icon" type="image/x-icon" th:href="@{${webconfig.websiteicon}}" />
    <link rel="stylesheet" th:href="@{/stage/css/typo.css}">
    <link rel="stylesheet" th:href="@{/stage/css/animate.css}"  >
    <link rel="stylesheet" th:href="@{/stage/css/me.css}" >
    <link rel="stylesheet" th:href="@{/stage/lib/prism/prism.css}">
    <link rel="stylesheet" th:href="@{/stage/lib/tocbot/tocbot.css}">
    <script th:src="@{/stage/lib/prism/prism.js}"></script>
    <script th:src="@{/stage/lib/tocbot/tocbot.js}"></script>
    <script th:src="@{/stage/lib/qrcode/qrcode.js}"></script>
    <script th:src="@{/stage/lib/waypoints/jquery.waypoints.min.js}"></script>
</head>
<body>

<!--导航-->
<footer th:replace="fontdesk/head::footer-fragment-head"></footer>
<!--中间-->

<div id="waypoint" class="m-container m-padded-tb-big animated fadeIn">

    <div class="ui container">
        <div class="ui top attached segment">
            <div class="ui  horizontal link list">
                <div class="item">
                    <img th:src="@{${webconfig.websiteadimg}}" alt="" class="ui avatar image">
                    <div class="content">
                        <a href="#" class="header" th:text="${webconfig.websiteadname}">惜缘</a>
                    </div>
                </div>
                <div class="item">
                    <i class="iconfont icon-rili"></i><span th:text="${#dates.format(arcontxt.createtime,'yyyy-MM-dd')}">2021-02-01</span>
                </div>
                <div class="item">
                    <i class="iconfont icon-chakanmian"></i><span th:text="${arcontxt.watchnumber}">2356</span>
                </div>
            </div>
        </div>

        <div class="ui attached segment">
            <!--图片-->
            <img th:src="@{${arcontxt.articleimg}}" alt="" class="ui fluid rounded image">
        </div>

        <div class="ui attached padded segment">
            <!--内容-->
            <div class="ui right aligned basic segment">
                <div class="ui orange basic label">原创</div>
            </div>

            <h2 class="ui center aligned header" th:text="${arcontxt.articletitle}">linux zip文件解压命令详解</h2>
            <div id="content" class="typo  typo-selection js-toc-content m-padded-lr-responsive m-padded-tb-large" th:utext="${arcontxt.articlecontext}">
                <h1>文章显示</h1>
            </div>

            <!--标签-->
            <div class="m-padded-lr-responsive ">
                <div class="ui basic teal left pointing label" th:text="${arcontxt.articletag.arlablename}">方法论</div>
            </div>
            <!--赞赏-->
            <div class="ui center aligned basic segment">
                <button id="payButton" class="ui orange basic circular button">赞赏</button>
            </div>

            <div class="ui payQ flowing popup  transition hidden">
                <div class="ui orange basic label">
                    <div class="ui images" style="font-size: inherit !important;">
                        <div class="image">
                            <img th:src="@{${webconfig.websitezfbcaqr}}" alt="" class="ui rounded bordered image" style="width: 120px;">
                            <div>支付宝支付</div>
                        </div>
                        <div class="image">
                            <img th:src="@{${webconfig.websitewxcaqr}}" alt="" class="ui rounded bordered image" style="width: 120px;">
                            <div>微信支付</div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="ui attached positive message">
            <!--博客信息-->
            <div class="ui middle aligned grid">
                <div class="eleven wide column">
                    <ul class="list">
                        <li>作者：<span th:text="${webconfig.websiteadname}">西苑</span><a th:href="@{'/blogabout'}" target="_blank">（联系作者）</a></li>
                        <li>最后更新时间：<span th:text="${#dates.format(arcontxt.createtime,'yyyy-MM-dd HH:mm:ss')}"></span></li>
                        <li>版权声明：自由转载-非商用-非衍生-保持署名</li>
                        <li>公众号转载：请在文末添加作者公众号二维码</li>
                    </ul>
                </div>

                <div class="five wide column">
                    <img th:src="@{${webconfig.websitewxgzh}}" alt="" class="ui right floated rounded bordered image" style="width: 110px;">
                </div>
            </div>
        </div>
    </div>

</div>
<div id="toolbar" class="m-padded m-fixed m-right-bottom" style="display: none;">
    <div class="ui vertical icon buttons ">
        <button type="button" class="ui toc teal button">目录</button>
        <button class="ui wechat icon button"><i class="weixin icon"></i></button>
        <div id="toTop-button" class="ui icon button"><i class="chevron up icon"></i></div>
    </div>
    <div id="qrcode" class="ui wechat-qr flowing popup left center transition hidden" style="inset: 36.344px 64px auto auto; width: 130px !important;">

    <canvas width="110" height="110" style="display: none;"></canvas><img width="110px" height="110px" th:src="@{${webconfig.websiteqrcode}}" style="display: block;">
</div>
</div>
<div class="ui toc-container flowing popup transition hidden" style="width: 250px!important;">
    <ol class="js-toc">

    </ol>
</div>

<!--底部-->
<!--底部-->
<footer  th:replace="fontdesk/foot::footer-fragment">

</footer>




<script th:inline="javascript">
    $(".m-mobile-show").click(function () {
        $(".m-item").toggleClass("m-mobile-hide");
    });

    tocbot.init({
        // Where to render the table of contents.
        tocSelector: '.js-toc',
        // Where to grab the headings to build the table of contents.
        contentSelector: '.js-toc-content',
        // Which headings to grab inside of the contentSelector element.
        headingSelector: 'h1, h2, h3,h4',
    });

    $('.toc.button').popup({
        popup : $('.toc-container.popup'),
        on : 'click',
        position: 'left center'
    });

    $("#payButton").popup({
        popup:$(".payQ.popup"),
        //on:'click',
        position:'bottom center'
    });

    $('.wechat').popup({
        popup : $('.wechat-qr'),
        position: 'left center'
    });

    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });

    $('#toTop-button').click(function () {
        window.scrollTo({
            top: 0,
            behavior: "smooth"
        });
    });

    var waypoint = new Waypoint({
        element: document.getElementById('waypoint'),
        handler: function(direction) {
            if (direction == 'down') {
                $('#toolbar').show(100);
            } else {
                $('#toolbar').hide(500);
            }
            console.log('Scrolled to waypoint!  ' + direction);
        }
    })

    //评论表单验证
    $('.ui.form').form({
        fields: {
            title: {
                identifier: 'content',
                rules: [{
                    type: 'empty',
                    prompt: '请输入评论内容'
                }
                ]
            },
            content: {
                identifier: 'nickname',
                rules: [{
                    type: 'empty',
                    prompt: '请输入你的大名'
                }]
            },
            type: {
                identifier: 'email',
                rules: [{
                    type: 'email',
                    prompt: '请填写正确的邮箱地址'
                }]
            }
        }
    });

    $('#commpostid').click(function () {
        var boo = $('.ui.form').form('validate form');
        if (boo) {
            console.log('校验成功');
            //postData();
        } else {
            console.log('校验失败');
        }
    });


    function postData() {
        $("#comment-container").load(/*[[@{/comments}]]*/"",{
            "commentid" : $("[name='commentid']").val(),
            "blogid" : $("[name='blogid']").val(),
            "nickname": $("[name='nickname']").val(),
            "email"   : $("[name='email']").val(),
            "content" : $("[name='content']").val()
        },function (responseTxt, statusTxt, xhr) {
//        $(window).scrollTo($('#comment-container'),500);
            clearContent();
        });
    }

    function clearContent() {
        $("[name='content']").val('');
        $("[name='commentid']").val(-1);
        $("[name='content']").attr("placeholder", "请输入评论信息...");
    }

    function reply(obj) {
        var commentId = $(obj).data('commentid');
        var commentNickname = $(obj).data('commentnickname');
        $("[name='content']").attr("placeholder", "");
        $("[name='content']").attr("value", "@"+commentNickname).focus();
        $("[name='commentid']").val(commentId);
        $(window).scrollTo($('#comment-form'),500);
    }
</script>

</body>
</html>